$(function() {
	//模拟下拉菜单
	var dropDown = $('.dropdown');
	var optionDom = $('.dropdown .option');
	var ulDom = $('.dropdown .option ul');
	var liDom = $('.dropdown .option ul li');
	var textDom = $('.dropdown .text');
	var triangleDom = $('.triangle');
	var index = -1;
	
	dropDown.click(function() {
		event.stopPropagation();
		
		var $currentOption = $(this).children('.option');
		var $currentTriangle = $(this).children('.triangle');
		optionDom.not($currentOption).slideUp(200);
		triangleDom.not($currentTriangle).removeClass('rotate');
		
		$currentOption.toggle(200);
		$currentTriangle.toggleClass('rotate');
	})
	
	ulDom.on('click', 'li', function() {
		var value = $(this).html();
		$(this).parents('.dropdown').children('.text').html(value);
	})
	
	$(document).click(function() {
		optionDom.slideUp(200);
		triangleDom.removeClass('rotate');
	})
})
